﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.WebSockets;
using System.Text;
using System.Threading.Tasks;

namespace _06_AOP
{
    public class BusinessLogic
    {
       
        /// <summary>
        /// 定义标准1
        /// </summary>
        public interface IPhoneService
        {
            string Mobile { get; set; }
            string Message { get; set; }
            void Send();
        }
        /// <summary>
        /// 定义标准2
        /// </summary>
        public interface IEmailService
        {
            string Email { get; set; }
            string Message { get; set; }
            void Send();
        }
        /// <summary>
        /// 业务逻辑1
        /// </summary>
        public class PhoneService : IPhoneService
        {
            public string Mobile { get; set; }
            public string Message { get; set; }

            public PhoneService(string mobile, string message)
            {
                Mobile = mobile;
                Message = message;
            }

            public virtual void Send()
            {
                Console.WriteLine($"已发送短信：{Message}到{Mobile}");
            }
        }
        /// <summary>
        /// 业务逻辑2
        /// </summary>
        public class EmailService : IEmailService
        {
            public string Email { get; set; }
            public string Message { get; set; }

            public EmailService(string email, string message)
            {
                Email = email;
                Message = message;
            }

            public virtual void Send()
            {
                Console.WriteLine($"已发送邮件：{Message}到{Email}");
            }
        }

        public class DbContext
        {
            
        }
        
        public class AService
        {
            public DbContext DbContext { get; }
            
            public AService(DbContext context)
            {
                DbContext = context;
            }
        }
    }
}
